// 路由模块化文件封装
import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);



// 注册全局组件(引入组件 挂载组件 在模板中使用)
import TodoList from '../components/TodoList'
Vue.component(TodoList.name,TodoList);
import Header from '../components/Header'
Vue.component(Header.name,Header);
import Node from '../components/Node' //阅读笔记
Vue.component(Node);
import NodeDetail from '../components/NodeDetail'
import Clock from '../components/Clock' //打卡
import ClockDetail from '../components/ClockDetail'
import Schedule from '../components/Schedule'
import User from  '../components/User'  //用户中心
import User_friend from '../components/User_friend'
import User_mine from '../components/User_mine'
import User_group from '../components/User_group'


// 定义路由
const routes = [
  { path: '/todoList', component: TodoList },
  { path: '/node', component: Node },  //阅读笔记
  // { path: '/node/nodeDetail', component: NodeDetail },
  { path: '/node/nodeDetail/:node', component: NodeDetail },
  { path: '/clock', component: Clock,name:'clock' },  //打卡
  { path: '/clock/clickDetail', component: ClockDetail },
  { path: '/schedule', component: Schedule },  //日程
  {
    path: '/user',
    component: User ,
    children:[
      {path:'user_friend',component:User_friend},
      {path:'user_mine',component:User_mine},
      {path:'user_group',component:User_group}
    ]
  },
  { path: '/', redirect:  '/todoList'}
];


// vueRouter实例化 json对象
const router=new VueRouter({
  mode:'history', /* hash模式改为history模式  地址栏没有#号 但是后端需要做一些配置 */
  routes
});

export default router;
